<template>
  <div id="art">
    <div class="art-bg">
      <img :src="`${baseURL}/jd_card/index/blessing7/bacc.jpg`" alt="" />
    </div>
    <div class="art-title">
      <p class="p-top">精选祝福卡</p>
      <p class="p-sub">福气满满环绕每一天</p>
      <div class="more" @click="goMore">更多</div>
    </div>
    <div class="art-scroll">
      <div class="art-card" v-for="(item, index) of artData" :key="index" :class="index==artData.length-1?'marginRight':''">
        <div class="links" @click="gopro(item.gid)">
          <img
            :src="`${baseURL}/jd_card/goods/${item.gpic}`"
            alt=""
          />
          <p class="card-title">
            {{ item.gtitle }}
          </p>
          <p class="card-price">￥{{ item.gprice }}</p>
        </div>
        <div class="add-car" @click.stop></div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      artData:[],
    };
  },
  methods: {
    goMore() {
      this.$router.push('/sort');
    },
    update(i) {
      console.log(i);
      this.artData = i;
    },
    gopro(gid) {
      this.$router.push({
        path: "/products",
        query: {
          gid,
        },
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.marginRight{
  margin-right:0.63rem
}
#art {
  position: relative;
  padding: 1.5625rem 0 0.9375rem;
  background-color: #f5f5f5;
  .art-bg {
    width: 100%;
    background-color: #fff;
    position: absolute;
    top: 0;
    left: 0;
    img {
      width: 100%;
      height: 18.59375rem;
      border-radius: 0 0.3125rem 0;
    }
  }
  .art-title {
    position: relative;
    color: white;
    padding-left: .84375rem;
    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: .25rem;
      height: 2.78125rem;
      background-color: #fff;
    }
    .p-top {
      margin: 0 0 .46875rem 0;
      font-size: 1rem;
    }
    .p-sub {
      margin: 0;
      font-size: .75rem;
    }
    .more {
      position: absolute;
      top: 0;
      right: 0;
      width: 4.625rem;
      line-height: 1.5rem;
      background: -webkit-linear-gradient(
        left,
        rgba(255, 255, 255, 0.6),
        rgba(255, 255, 255, 0)
      );
      border-top-left-radius: 1.875rem;
      border-bottom-left-radius: 1.875rem;
      text-align: center;
      font-size: .875rem;
      color: #000;
      &:after {
        content: "";
        display: inline-block;
        width: .3125rem;
        height: .5625rem;
        background: url("http://47.98.224.84:3000/jd_card/tubiao/下载.png") no-repeat;
        background-size: 100% 100%;
        margin-left: .375rem;
      }
    }
  }
  .art-scroll {
    overflow: hidden;
    overflow-x: scroll;
    font-size: 0;
    margin-top: 1.5625rem;
    text-align: center;
    white-space: nowrap;
    position: relative;
    .art-scroll :last-child {
       margin-right: 0.625rem !important;
    }
    .art-card {
      display: inline-block;
      width: 9.375rem;
      padding: 0.625rem 0;
      margin-left: 0.625rem;
      position: relative;
      background-color: #fff;
      border-radius: 0.3125rem;
      
      .links {
        outline: 0;
        text-decoration: none;
        img {
          width: 8.75rem;
          height: 8.75rem;
        }
        .card-title {
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;
          color: #251d1d;
          line-height: 1rem;
          padding: 0 0.625rem;
          text-align: left;
          font-size: 0.75rem;
          margin-bottom: 0.625rem;
          margin-top: 0.5rem;
          white-space: normal;
        }
        .card-price {
          margin: 0 0 0.3125rem 0;
          padding: 0 0.625rem;
          text-align: left;
          color: #ec3838;
          font-size: 1.125rem;
        }
      }
      .add-car {
        position: absolute;
        margin: 0;
        width: 2.5rem;
        height: 2.5rem;
        right: 0.375rem;
        bottom: 0.375rem;
        background: url("/images/tubiao/addcar.png") no-repeat
          center center;
        background-size: 1.625rem 1.5625rem;
      }
    }
  }
}
</style>